import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        useMaterial3: false, // 禁用Material3样式
        primarySwatch: Colors.blue,
      ),
      home: const AddNum(),
    );
  }
}

class AddNum extends StatefulWidget {
  const AddNum({super.key});

  @override
  State<AddNum> createState() => _AddNumState();
}

class _AddNumState extends State<AddNum> {
  int countNum = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("你好Flutter"),
        backgroundColor: Colors.blue,
      ),
      body: Center(
        child: Column(
          children: [
            const SizedBox(height: 100),
            Text("$countNum", style: Theme.of(context).textTheme.headlineLarge),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton.small(
        child: const Icon(Icons.add),
        onPressed: () {
          setState(() {
            countNum++;
          });
        },
      ),
    );
  }
}
